﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using org.sablecc.grammars.java_1_5.analysis;
using org.sablecc.grammars.java_1_5.node;
using Commander.Parsing.Visitors;

namespace Commander.Parsing {
  public class ASTVisitor : DepthFirstAdapter {

    public override void CaseANormalClassDeclaration(ANormalClassDeclaration node) {
      var visitor = new ClassVisitor();
      node.Apply(visitor);

      //Info.InnerClasses.Add(visitor.Info);
      // base.CaseANormalClassDeclaration(node);
    }

    //public override void CaseAClassBody(org.sablecc.grammars.java_1_5.node.AClassBody node) {
    //  base.CaseAClassBody(node);
    //}

    //public override void CaseAClassTypeDeclaration(org.sablecc.grammars.java_1_5.node.AClassTypeDeclaration node) {
    //  base.CaseAClassTypeDeclaration(node);
    //}

    //public override void InAClassTypeDeclaration(org.sablecc.grammars.java_1_5.node.AClassTypeDeclaration node) {
    //  base.InAClassTypeDeclaration(node);
    //}

    //public override void CaseAMethodClassMemberDeclaration(org.sablecc.grammars.java_1_5.node.AMethodClassMemberDeclaration node) {
    //  //var jj = (org.sablecc.grammars.java_1_5.node.AMethodDeclaration)node.GetMethodDeclaration();
    //  //APrimitiveMethodHeader
    //  base.CaseAMethodClassMemberDeclaration(node);
    //}

    //public override void CaseANormalAnnotation(ANormalAnnotation node) {
    //  base.CaseANormalAnnotation(node);
    //}

    //public override void CaseAMarkerAnnotation(AMarkerAnnotation node) {
    //  base.CaseAMarkerAnnotation(node);
    //}
    //public override void CaseAMethodDeclaration(org.sablecc.grammars.java_1_5.node.AMethodDeclaration node) {
    //  var mv = new MethodVisitor();
    //  node.Apply(mv);
    //  base.CaseAMethodDeclaration(node);
    //}

    //public override void CaseASimpleMethodInvocation(org.sablecc.grammars.java_1_5.node.ASimpleMethodInvocation node) {
    //  base.CaseASimpleMethodInvocation(node);
    //}

    

    //public override void CaseAClassNameMethodInvocation(org.sablecc.grammars.java_1_5.node.AClassNameMethodInvocation node) {
    //  base.CaseAClassNameMethodInvocation(node);
    //}
    ////CaseAMethodInvocationStatementExpression
    //public override void CaseAMethodInvocationStatementExpression(org.sablecc.grammars.java_1_5.node.AMethodInvocationStatementExpression node) {
    //  base.CaseAMethodInvocationStatementExpression(node);
    //  var jj = node.GetMethodInvocation();
    //  int j = 0;
    //}
    //public override void CaseASimpleClassInstanceCreationExpression(org.sablecc.grammars.java_1_5.node.ASimpleClassInstanceCreationExpression node) {
    //  base.CaseASimpleClassInstanceCreationExpression(node);
    //}

    //public override void CaseASuperMethodInvocation(org.sablecc.grammars.java_1_5.node.ASuperMethodInvocation node) {
    //  base.CaseASuperMethodInvocation(node);
    //}

    //public override void CaseAPrimaryMethodInvocation(org.sablecc.grammars.java_1_5.node.APrimaryMethodInvocation node) {
    //  base.CaseAPrimaryMethodInvocation(node);
    //}

    //public override void CaseATypeNameMethodInvocation(org.sablecc.grammars.java_1_5.node.ATypeNameMethodInvocation node) {
    //  base.CaseATypeNameMethodInvocation(node);
    //}

    //public override void CaseAPackageDeclaration(APackageDeclaration node) {
    //  base.CaseAPackageDeclaration(node);
    //}

    //public override void CaseASingleImportDeclaration(ASingleImportDeclaration node) {
    //  base.CaseASingleImportDeclaration(node);
    //}

    //public override void CaseACompilationUnit(org.sablecc.grammars.java_1_5.node.ACompilationUnit node) {
    //  base.CaseACompilationUnit(node);
    //}

    ////can get class identifiers
    //public override void InAClassBody(org.sablecc.grammars.java_1_5.node.AClassBody node) {
    //  base.InAClassBody(node);
    //  var jawn = node.GetClassBodyDeclarations();
    //  Console.WriteLine("here");
    //}

    ////can get class name
    //public override void CaseANormalClassDeclaration(org.sablecc.grammars.java_1_5.node.ANormalClassDeclaration node) {
    //  base.CaseANormalClassDeclaration(node);
    //}

    //public override void OutAClassTypeDeclaration(org.sablecc.grammars.java_1_5.node.AClassTypeDeclaration node) {
    //  base.OutAClassTypeDeclaration(node);
    //}

    ////can get parameter list
    ////can get method name
    //public override void CaseAMethodDeclarator(org.sablecc.grammars.java_1_5.node.AMethodDeclarator node) {
    //  base.CaseAMethodDeclarator(node);
    //  var jawn = node.GetFormalParameterList();
    //  int p = 0;
    //}

    //public override void CaseANormalClassClassDeclaration(ANormalClassClassDeclaration node) {
    //  base.CaseANormalClassClassDeclaration(node);
    //}

    //public override void CaseAMemberClassBodyDeclaration(AMemberClassBodyDeclaration node) {
    //  base.CaseAMemberClassBodyDeclaration(node);
    //}

    //public override void CaseAFieldClassMemberDeclaration(org.sablecc.grammars.java_1_5.node.AFieldClassMemberDeclaration node) {
    //  base.CaseAFieldClassMemberDeclaration(node);
    //}

    //public override void CaseAPrimitiveFieldDeclaration(org.sablecc.grammars.java_1_5.node.APrimitiveFieldDeclaration node) {
    //  base.CaseAPrimitiveFieldDeclaration(node);
    //}

    ////get name of variable
    ////parent has all useful info
    //public override void CaseAOneVariableDeclarators(org.sablecc.grammars.java_1_5.node.AOneVariableDeclarators node) {
    //  base.CaseAOneVariableDeclarators(node);
    //}

    ////get fields in the class + the good stuff about it
    //public override void CaseAReferenceFieldDeclaration(org.sablecc.grammars.java_1_5.node.AReferenceFieldDeclaration node) {
    //  base.CaseAReferenceFieldDeclaration(node);
    //}

    //public override void CaseAVariableDeclarationBlockStatement(org.sablecc.grammars.java_1_5.node.AVariableDeclarationBlockStatement node) {
    //  base.CaseAVariableDeclarationBlockStatement(node);
    //}

    //public org.sablecc.grammars.java_1_5.node.AReferenceLocalVariableDeclaration elVar;

    //public override void CaseALocalVariableDeclarationStatement(org.sablecc.grammars.java_1_5.node.ALocalVariableDeclarationStatement node) {
    //  if (node.GetLocalVariableDeclaration() is org.sablecc.grammars.java_1_5.node.AReferenceLocalVariableDeclaration) {
    //    elVar = (org.sablecc.grammars.java_1_5.node.AReferenceLocalVariableDeclaration)node.GetLocalVariableDeclaration();
    //    //Console.WriteLine(jj.GetIdentifier().ToString());
    //  }
    //  base.CaseALocalVariableDeclarationStatement(node);
    //}

    ////can capture custom class variable
    //public override void CaseAReferenceLocalVariableDeclaration(org.sablecc.grammars.java_1_5.node.AReferenceLocalVariableDeclaration node) {
    //  base.CaseAReferenceLocalVariableDeclaration(node);
    //}

    ////can capture regular local variables
    //public override void CaseAPrimitiveLocalVariableDeclaration(org.sablecc.grammars.java_1_5.node.APrimitiveLocalVariableDeclaration node) {
    //  base.CaseAPrimitiveLocalVariableDeclaration(node);
    //}

    ////not usefu
    //public override void CaseAVariableDeclarationForInit(org.sablecc.grammars.java_1_5.node.AVariableDeclarationForInit node) {
    //  base.CaseAVariableDeclarationForInit(node);
    //}

    //public override void CaseEOF(org.sablecc.grammars.java_1_5.node.EOF node) {
    //  base.CaseEOF(node);
    //}

    //public override void OutAClassBody(org.sablecc.grammars.java_1_5.node.AClassBody node) {
    //  base.OutAClassBody(node);
    //}

  }
}
